/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.lujotar.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author RamiroHenao
 */
@Entity
@Table(name = "premios")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Premio.findAll", query = "SELECT p FROM Premio p"),
    @NamedQuery(name = "Premio.findById", query = "SELECT p FROM Premio p WHERE p.id = :id"),
    @NamedQuery(name = "Premio.findByDescripcion", query = "SELECT p FROM Premio p WHERE p.descripcion = :descripcion"),
    @NamedQuery(name = "Premio.findByEstado", query = "SELECT p FROM Premio p WHERE p.estado = :estado"),
    @NamedQuery(name = "Premio.findByPuntos", query = "SELECT p FROM Premio p WHERE p.puntos = :puntos")})
public class Premio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Size(max = 50)
    @Column(name = "descripcion")
    private String descripcion;
    @Size(max = 50)
    @Column(name = "estado")
    private String estado;
    @Column(name = "puntos")
    private Integer puntos;
    @OneToMany(mappedBy = "idPremio")
    private List<Canjeo> canjeoList;

    public Premio() {
    }

    public Premio(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public Integer getPuntos() {
        return puntos;
    }

    public void setPuntos(Integer puntos) {
        this.puntos = puntos;
    }

    @XmlTransient
    public List<Canjeo> getCanjeoList() {
        return canjeoList;
    }

    public void setCanjeoList(List<Canjeo> canjeoList) {
        this.canjeoList = canjeoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Premio)) {
            return false;
        }
        Premio other = (Premio) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.lujotar.entities.Premio[ id=" + id + " ]";
    }
    
}
